package ca.eloas.judging.model;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Parent;

/**
 * @author JP
 */
@Entity
public class TeamObject extends DBObjectImpl<TeamObject> implements Team {

    private String name;

    @Parent
    private Key<CompetitionObject> competition;

    public TeamObject() {
    }

    public TeamObject(CompetitionObject competitionObject, String name) {
        this.name = name;
        this.competition =  competitionObject.getKey();
    }

    @Override
    protected Key<?> getParentKey() {
        return competition;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {

        this.name = name;
    }

    public ScoreObject score(JudgeObject j, int score, String comment) {

        return new ScoreObject(this, j, score, comment);
    }

}
